package com.sf.fy.uav.common.config;

import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author 01430312
 */
@RestControllerAdvice
public class ValidExceptionHandler {
    @ExceptionHandler(Exception.class)
    public String validExceptionHandler(BindingResult bindingResult) {
        return bindingResult.getAllErrors().get(0).getDefaultMessage();
    }
}
